// AnsiSequenceCollection.cpp: implementation of the CAnsiSequenceCollection class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AnsiTerminal.h"
#include "AnsiSequenceCollection.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CAnsiSequenceCollection::CAnsiSequenceCollection(IAnsiScreen *pAnsiScreen) :
m_displayAttributeSeqence(pAnsiScreen),

m_moveLeftSequence(pAnsiScreen),
m_moveUpSequence(pAnsiScreen),
m_moveRightSequence(pAnsiScreen),
m_moveDownSequence(pAnsiScreen),
m_moveToSequence(pAnsiScreen),

m_eraseScreenSequence(pAnsiScreen),
m_eraseLineSequence(pAnsiScreen),
m_insertLineSequence(pAnsiScreen),

m_delaySequence(pAnsiScreen)
{

}

CAnsiSequenceCollection::~CAnsiSequenceCollection()
{

}

CAnsiSequence* CAnsiSequenceCollection::FindSequence(const char FINAL_CHAR)
{
	switch(FINAL_CHAR)
	{
	case FINAL_CHAR_DISPLAYATTRIBUTE:
		return &m_displayAttributeSeqence;
	
	case FINAL_CHAR_MOVELEFT:
		return &m_moveLeftSequence;
	
	case FINAL_CHAR_MOVEUP:
		return &m_moveUpSequence;
	
	case FINAL_CHAR_MOVERIGHT:
		return &m_moveRightSequence;
	
	case FINAL_CHAR_MOVEDOWN:
		return &m_moveDownSequence;
	
	case FINAL_CHAR_MOVETO:
		return &m_moveToSequence;
	
	case FINAL_CHAR_ERASESCREEN:
		return &m_eraseScreenSequence;
		
	case FINAL_CHAR_ERASELINE:
		return &m_eraseLineSequence;

	case FINAL_CHAR_INSERTLINE:
		return &m_insertLineSequence;

	case FINAL_CHAR_DELAY:
		return &m_delaySequence;

	default:
		return &m_unknownSequence;
	}
}
